home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!wupost!waikato.ac.nz!ccc_rex
- From: ccc_rex@waikato.ac.nz
- Newsgroups: vmsnet.sources.games
- Subject: SNAKE 2/2
- Message-ID: <1992Feb27.143424.6696@waikato.ac.nz>
- Date: 27 Feb 92 14:34:23 +1300
- Organization: University of Waikato, Hamilton, New Zealand
- Lines: 583
-
- -+-+-+-+-+-+-+-+ START OF PART 2 -+-+-+-+-+-+-+-+
- X Write(esc,'Y',chr(31+X),Chr(31+Y));
- X at := Chr(0);
- Xend;
- X
- X
- XFunction Snake_Init(Var You : INteger ; Var Game_going : Integer):Integer;e
- Vxtern;
- X
- XProcedure Name_Set(Var Name : Name_Line );extern;
- X
- XProcedure Name_Get( VAR Name : Name_Line ; Play : Integer );extern;
- X
- XProcedure Score_Set( Player : INTEGER; VAR Score,Games_PLayed,wins : INteger
- V);
- X`09`09`09`09`09`09`09extern;
- XProcedure Score_Get( Player : INTEGER; VAR Score,Games_Played,wins : Integer
- V );
- X`09`09`09`09`09`09`09extern;
- XProcedure Snake_Start( Var Whos_PLaying : Integer ; var Rand : Positions );E
- Vxtern;
- X
- XProcedure Snake_Read(Var Directions : Player_Responce );Extern;
- X
- XProcedure Snake_Game_End;extern;
- X
- XProcedure Snake_Wait;Extern;
- X
- XProcedure Snake_Game_count( Var Num : Integer);extern;
- X
- XProcedure Snake_Dead(Var PLayer : Integer );extern;
- X
- XProcedure Sleep( Num_Sec : Integer);extern;
- X
- XProcedure Draw_Scores;
- X
- XVar I,num_on_table,play,max_score,Top_play,Total_Num_Games,This_score: Integ
- Ver;
- X
- X
- XBegin
- X Num_on_Table := 0;
- X Writeln(esc,'H',Esc,'J',Esc,'G',esc,'<');
- X Writeln(' Player User Name Score Game Won Gra
- Vph');
- X writeln(' ------ ---- ---- ----- ---- --- ---
- V--');
- X writeln;
- X Max_score := -99999;
- X
- X `7B Find The Top Player goes By The his Score And Num Of Games Played `7
- VD
- X For PLay := 1 to Max_Num_PLayers do begin
- X Score_get(Play,Score`5BPLay`5D,Game`5BPLay`5D,Games_won`5Bplay`5D);
- X If Game`5BPlay`5D > 0 Then Begin
- X This_score := Round(Score`5Bplay`5D / (Game`5Bplay`5D)**(0.8));
- X If This_score > Max_score Then Begin
- X Top_Play := Play;
- X Max_score := This_score + 1;
- X end;
- X end;
- X end;
- X For Play := 1 to Max_Num_PLayers do Begin
- X If Game`5BPLay`5D > 0 Then Begin `7B IF Games PLayed > 0 Then You A
- Vre PLaying `7D
- X Num_On_Table := Num_On_Table + 1;
- X If PLay = Top_PLay Then`20
- X Write(esc,'`5B1m'); `7B High intensity Flash `7D
- X Write(Play:4);
- X Write(' ',Name`5BPlay`5D:32);
- X write(Score`5BPLay`5D:7); `7B Print Info `7D
- X Write(Game`5BPlay`5D:6);
- X Write(Games_won`5Bplay`5D:5);
- X Write(' ',Esc,'`5B7m'); `7B Rev Video `7D
- X If PLay = Top_PLay Then `20
- X Write(' *** Champ *** ')
- X `09 Else
- X For I := 1 to Round(Score`5Bplay`5D*15 / ((Game`5Bplay`5D)**(0.8
- V)*max_score)) do`20
- X Write(' ');
- X Writeln(esc,'`5B0m'); `7B Normal Video `7D
- X end;
- X End;
- X writeln;
- X
- X`7B Print The Games You Have Played With The Totak Num of Games Played so Fa
- Vr `7D
- X Snake_Game_Count( Total_Num_games );
- X Writeln(' Game # ',Game`5BYou`5D:1,'`09Total # ',Total_Num_Games:1);
- X writeln;
- X writeln;
- X If Num_on_Table <= 1 Then`20
- X Goto 9999;
- X writeln(' Please Wait For Next Game ..... ');
- X writeln(esc,'`5B?2l',esc,'F');
- Xend;
- X
- XProcedure Draw_screen;
- X
- XVar play,I,X,Y,Line_at : Integer;
- X
- X Function Min(A,B:Integer):Integer;
- X
- X Begin
- X If A < B Then`20
- X Min := A`20
- X Else
- X Min := B
- X end;
- X
- XBegin `7B Draw Screen `7D
- X Write(at(1,1),esc,'J',esc,'<',esc,'(0',esc,'<',esc,'(0'); `7B Clear H
- Vome `7D
- X Write(esc,'#6l');
- X For Y := 1 To (Screen_Dim_Y-2) Do`20
- X Write('q');
- X Writeln('k');
- X For X := 2 To ( Screen_dim_X - 1 ) Do begin
- X Write(esc,'#6x');
- X For Y := 1 to (Screen_Dim_Y-1) do`20
- X Write('`7E');
- X Writeln('x');
- X end;
- X write(esc,'#6m');
- X For Y := 1 to (Screen_Dim_Y-1) Do`20
- X Write('q');
- X Writeln('j');
- X
- X`7B Show Who You Are At Thje Bottom Of The Screen `7D
- X Writeln(`7BEsc,'`5B24;1H',Esc,'#6',Esc,'(BYou # ',You:1,`7D
- X`09 esc,'`5B?2l',esc,'F',at(1,1)); `20
- Xend;
- X
- X `20
- XProcedure initalise_Positions;
- X
- X
- X
- XVar Mult,Play,X,Y : Integer;
- X
- X Rand`09 : Positions;
- X
- XBegin
- X
- XPlayers_Removing := -1; `7B On First Few Moves Don't remove Tail `7D
- X
- XSnake_Start(Who_Is_Playing,Rand);
- X
- X
- X`7B Randomly Position The Starting Pos Of The PLayers `7D
- XFor play := 1 to Max_num_players do Begin
- X Head_X`5BPlay`5D := Init_Pos_X`5BRand`5BPlay`5D`5D;
- X Head_Y`5Bplay`5D := Init_Pos_Y`5BRand`5BPLay`5D`5D;
- X Move_X`5Bplay`5D := 1;
- X MOve_Y`5BPlay`5D := 0;
- Xend;
- XTail_X := Head_X;
- XTail_Y := Head_Y;
- X
- XMult := 2**7; `7B 2 ** Number of PLayers - 1`7D
- XNum_Players := 0;
- X
- X`7B Examine Each Bit In Mult To See If You Are Playing `7D
- XMax_player_number := 0;
- XFor Play := Max_Num_PLayers downto 1 do begin
- X If ( Who_Is_PLaying div Mult ) = 1 Then begin
- X Name_Get(Name`5BPlay`5D,Play);
- X Num_Players := Num_PLayers + 1;
- X Quit`5Bplay`5D := False; `7B Bit Set You Are Playing `7D
- X Who_is_Playing := Who_is_Playing - Mult;
- X If Max_player_number = 0 Then`20
- X Max_player_number := play ;`7B The Highest Numbered Player `7D
- X end else begin
- X Quit`5BPlay`5D := True; `7B Bit Not Set Not Playing ie Quit `7D
- X end;
- X Mult := Mult div 2;
- Xend;
- X
- XNum_Moved_Last_Round := 0;
- X
- X`7B If You are PLaying Then You Havnt Died `7D
- XFor Play := 1 to Max_Num_Players Do Begin
- X If Not Quit`5BPlay`5D Then Begin
- X Died`5BPlay`5D := False;
- X Num_Moved_Last_Round := Num_Moved_Last_Round + 1;
- X end else
- X Died`5Bplay`5D := True;
- X responce`5BPlay`5D := ' '; `7B Initalise First Responce Should Not BE N
- Veeded `7D
- Xend;
- XFor PLay := 1 to Max_Num_PLayers do`20
- X Game`5BPLay`5D := Game`5BPLay`5D + 1;
- XFor X := 1 To Screen_Dim_X do`20
- X For Y := 1 to Screen_Dim_Y do
- X Screen`5BX,y`5D := '`7E';
- XFor Y := 1 To Screen_Dim_Y do Begin
- X Screen`5B1,Y`5D := 'q';
- X Screen`5BScreen_Dim_X,Y`5D := 'q';
- Xend;
- XFor X := 1 To Screen_Dim_X Do Begin
- X Screen`5BX,1`5D := 'x';
- X Screen`5BX,Screen_Dim_Y`5D := 'x';`20
- Xend;
- XScreen`5B1,1`5D := 'l';
- XScreen`5B1,Screen_Dim_Y`5D := 'k';
- XScreen`5BScreen_Dim_X,1`5D := 'm';
- XScreen`5BScreen_Dim_X,Screen_Dim_y`5D := 'j';
- XHead_Sym`5B1`5D := chr(128+ord('1')); `7B Set The Bits In The Chars `7D
- XHead_Sym`5B2`5D := chr(128+ord('2'));
- XHead_Sym`5B3`5D := chr(128+ord('3'));
- XHead_Sym`5B4`5D := chr(128+ord('4'));
- XHead_Sym`5B5`5D := chr(128+ord('5'));
- XHead_Sym`5B6`5D := chr(128+ord('6'));
- XHead_Sym`5B7`5D := chr(128+ord('7'));
- XHead_Sym`5B8`5D := chr(128+ord('8'));
- X
- XFor Play := 1 to Max_Num_PLayers do`20
- X If Not Quit`5Bplay`5D Then`20
- X Screen`5BHead_X`5BPlay`5D,Head_Y`5BPlay`5D`5D := 'O';
- X`7B Note If This Procedure Is Only Called When You Are Master Snake`20
- X Draw Screen Should Be In The Mainlkine Before Init_pos
- X And The Writing Of The PLayers Pos Should Be To The Buffer`20
- X And Then Written To All Who Are PLaying `7D
- X
- XDraw_screen; `20
- X
- X`7B Pos Inital Player Positions `7D
- XFor Play := 1 to Max_Num_PLayers do `20
- X If ( Not Quit`5BPlay`5D ) Then `20
- X Writeln(at(Head_X`5BPlay`5D,Head_Y`5BPlay`5D),Head_sym`5BPlay`5D);
- Xend;
- X
- XProcedure Initalise_Mainline;
- X
- XVar Zero,Init_Rep,PLay,Name_pos,Game_Going : Integer;
- X
- XProcedure Verify_name(VAr Name : Name_Line );
- X
- XVar I : INteger;
- X
- X
- XBegin
- X For I := 1 to Max_Name_length do `7B Remove All Invalid Chars From The
- V Name`7D
- X If ( Name`5Bi`5D < ' ' ) or ( Name`5Bi`5D > '`7E' ) Then Begin
- X Write(chr(7));
- X Name`5Bi`5D := ' ';
- X end;
- Xend;
- X
- X
- XBegin
- X Esc := Chr(27);
- X Seed := Clock;
- X TT_Len := 0;
- X `20
- X
- X `7B set where Each Player Starts `7D
- X
- X Init_pos_X`5B1`5D := 2;
- X Init_pos_Y`5B1`5D := 2;
- X `20
- X Init_pos_X`5B2`5D := Screen_dim_x - 1;
- X Init_pos_Y`5B2`5D := Screen_dim_Y - 1;
- X `20
- X Init_pos_X`5B3`5D := 2;
- X Init_pos_Y`5B3`5D := Screen_dim_y - 1;
- X `20
- X Init_pos_X`5B4`5D := Screen_dim_x - 1;
- X Init_pos_Y`5B4`5D := 2;
- X `20
- X Init_pos_X`5B5`5D := 2;
- X Init_pos_Y`5B5`5D := Screen_dim_Y div 2;
- X `20
- X Init_pos_X`5B6`5D := Screen_dim_x - 1 ;
- X Init_pos_Y`5B6`5D := Screen_dim_Y div 2;
- X `20
- X Init_pos_X`5B7`5D := Screen_dim_x div 2;
- X Init_pos_Y`5B7`5D := 2;
- X `20
- X Init_pos_X`5B8`5D := Screen_dim_x div 2;
- X Init_pos_Y`5B8`5D := Screen_dim_Y - 1;
- X
- X Writeln(Esc,'<'); `7B Vt52 Mode `7D
- X Writeln(Esc,'`5B1;1H',Esc,'`5BJ'); `7B Clear Screen `7D
- X Init_rep := Snake_Init(You,Game_going);
- X You := You + 1; `20
- X If Init_rep = 1 Then Begin
- X `7B you are the First Person to play zero all the scores `7D
- X For Play := 1 to Max_Num_PLayers do begin
- X Zero := 0;
- X Score_Set(Play,Zero,zero,zero);
- X end;
- X Help_Screen;
- X Writeln(esc,'`5B1;1H',Esc,'`5B?2l');
- X Writeln(at(22,3),' Please Enter Your Name Player #',You:1);
- X Write(at(22,51));
- X Readln(Name`5BYou`5D);
- X Verify_Name(Name`5BYou`5D);
- X Name_set(Name`5BYou`5D);
- X Write(at(22,3), ' Hit < Return > When Others Ready ');
- X Readln;
- X Writeln;
- X Write(at(22,3), ' Please Wait For Game To Start ');
- X Writeln;
- X end Else Begin
- X If You = 0 Then Begin
- X Writeln(esc,'`5B1;18H',Esc,'#3SNAKE');
- X Writeln(esc,'`5B2;18H',Esc,'#4SNAKE');
- X Writeln(esc,'`5B4;8H' ,Esc,'#6Sorry No Snakes Available');
- X`09 Sleep(3);
- X goto 9999;
- X end else begin `7B Init_rep = 0 `7D`20
- X Help_Screen;
- X Writeln(esc,'`5B1;1H',Esc,'`5B?2l');
- X Writeln(at(22,3),' Please Enter Your Name Player # ',You:1);
- X Write(at(22,51));
- X Readln(Name`5BYou`5D);
- X Verify_name(Name`5BYou`5D);
- X Name_set(Name`5BYou`5D);
- X Writeln;
- X Write(at(22,3), ' Please Wait For Game To Start ');
- X Writeln;
- X If Game_Going = 1 Then`20
- X Snake_Game_End;
- X end;
- X end;
- X Game`5BYou`5D := 0;
- Xend `7B Initalise Mainline `7D;
- X
- XFunction Correct_Sym(Last_Move_X,Last_Move_Y,Move_X,Move_Y:Integer):Char;
- X
- XBegin `7B Calculates The Correct symbol To Write Given The Dir You Were In
- V `7D
- X Case (Last_Move_X+1) + (Last_Move_Y+1)*4 Of`20
- X 6 : `7B Down `7D
- X Case (Move_X+1) + (Move_Y+1)*4 Of`20
- X 6 : `7B Down `7D
- X Correct_Sym := 'x';
- X 9 : `7B Right `7D
- X Correct_Sym := 'm';
- X 1 : `7B Left `7D
- X Correct_Sym := 'j';
- X 4 : `7B Up Note : This Is Poss On First Move `7D
- X Correct_Sym := 'x';
- X end `7B Case `7D;
- X 4 : `7B Up `7D
- X Case (Move_X+1) + (Move_Y+1)*4 Of`20
- X 6 : `7B Down `7D
- X Correct_Sym := 'x';
- X 4 : `7B Up `7D
- X Correct_Sym := 'x'; `20
- X 9 : `7B Right `7D
- X Correct_Sym := 'l';
- X 1 : `7B Left `7D
- X Correct_Sym := 'k'; `20
- X end `7B Case `7D;
- X `20
- X 9 : `7B Right `7D
- X Case (Move_X+1) + (Move_Y+1)*4 Of`20
- X 6 : `7B Down `7D
- X Correct_Sym := 'k'; `20
- X 4 : `7B Up `7D
- X Correct_Sym := 'j'; `20
- X 9 : `7B Right `7D
- X Correct_Sym := 'q';
- X 1 : `7B Left `7D
- X Correct_Sym := 'q'; `20
- X end `7B Case `7D;
- X
- X 1 : `7B Left `7D
- X Case (Move_X+1) + (Move_Y+1)*4 Of`20
- X 9 : `7B Right `7D
- X Correct_Sym := 'q';
- X 6 : `7B Down `7D
- X Correct_Sym := 'l'; `20
- X 4 : `7B Up `7D
- X Correct_Sym := 'm'; `20
- X 1 : `7B Left `7D
- X Correct_Sym := 'q'; `20
- X end `7B Case `7D;
- X
- X end `7B Case `7D;
- Xend; `7B Correct Sym `7D
- X
- X`5BGLOBAL`5D Function Add_head( Var Responce : Player_responce ):Integer;
- X
- XVar Play, Num_Moved, Dir_X, Dir_Y, Pos_x, Pos_Y : Integer;
- X
- X
- X
- XProcedure Remove_tail( Var STail_X , STail_Y : Integer );
- X
- XVar Last_X,Last_Y : Integer;
- X
- XBegin `7B removes the Tail of the snake whose tail is at StailX,Y `7D
- X`7B The Character To Move is determined by the Char at the tail
- X and if a character joins up to it `7D
- X
- X Last_X := STail_X;
- X Last_Y := STail_Y;
- X Pos(STail_X,STail_Y,'`7E');
- X Case Screen`5BSTail_X,STail_Y`5D of`20
- X 'l' : If Screen`5BStail_X,STail_Y+1`5D In `5B'k','j','q'`5D Then`20
- X STail_Y := STail_Y + 1
- X Else
- X STail_X := STail_X + 1;
- X 'k' : If Screen `5BSTail_X,STail_Y-1`5D In `5B'l','m','q'`5D Then`2
- V0
- X STail_Y := STail_Y - 1
- X Else
- X Stail_X := STail_X + 1 ;
- X 'm' : If Screen`5BSTail_X,STail_Y+1`5D In `5B'k','j','q'`5D Then
- X Stail_Y := STail_Y + 1
- X Else
- X Stail_X := Stail_X - 1 ;
- X 'j' : If Screen`5BSTail_X,STail_Y-1`5D In `5B'm','l','q'`5D Then`20
- X STail_Y := STail_Y - 1
- X Else
- X STail_X := STail_X - 1;
- X 'x' : If Screen`5BSTail_X-1,STail_Y`5D In `5B'l','k','x'`5D Then`20
- X STail_X := STail_X - 1
- X Else
- X STail_X := STail_X + 1;
- X 'q' : If Screen`5BSTail_X,STail_Y - 1 `5D In `5B 'l','m','q'`5D The
- Vn`20
- X STail_Y := STail_Y - 1
- X Else
- X STail_Y := STail_Y + 1;
- X end `7B CAse `7D;
- X Screen`5BLast_X,Last_Y`5D := '`7E';
- Xend `7B remove_Tail`7D;
- X
- X
- XProcedure Remove_Players_tail( play : Integer );
- X
- XVar X,Y : Integer;
- X
- XBegin `7B Removed Odd Players Tails Of Play = 1 Even If 2 `7D
- X While Play <= Max_PLayer_Number do Begin
- X If Not Died`5BPlay`5D Then `20
- X Remove_tail(Tail_X`5BPLay`5D,Tail_Y`5BPLay`5D);
- X Play := Play + 2;
- X end;
- Xend;
- X
- X
- XProcedure Add_This_Players_Head;
- X
- Xbegin
- X If Not Quit`5BPlay`5D And (Ord(Responce`5BPLay`5D) = 0 ) Then begin
- X Died`5BPLay`5D := True; `7B If PLayer quit Then`20
- X Quit`5BPLay`5D := True; Initalise all Variables `7D
- X Game`5BPlay`5D := 0;
- X Score`5BPlay`5D := 0;
- X Games_Won`5BPLay`5D := 0;
- X Score_Set(Play,Score`5BPlay`5D,Game`5BPLay`5D,Games_Won`5BPLay`5D);
- X end else`20
- X If Not Died`5BPlay`5D Then Begin
- X Dir_X := Move_X`5BPlay`5D;
- X Dir_Y := Move_Y`5BPLay`5D;
- X`09 Pos_X := Head_X`5BPlay`5D;
- X Pos_Y := Head_Y`5BPlay`5D;
- X `7B Change Direction Of The Position You Move To is Not A Wall ie =
- V '.' `7D
- X Case Ord(responce`5BPlay`5D) Of`20
- X 8 : If Screen`5BPos_x-1,Pos_Y`5D = '`7E' Then Begin
- X Dir_X := -1 ;
- X Dir_Y := 0 ; `7B Moving Up `7D
- X end;
- X 2 : If Screen`5BPos_X+1,Pos_Y`5D = '`7E' Then Begin
- X Dir_X := 1;
- X Dir_Y := 0; `7B Moving Down `7D
- X end;
- X 4 : If Screen`5BPos_X,Pos_Y-1`5D = '`7E' Then Begin
- X Dir_X := 0; `7B Moving Left `7D
- X Dir_Y := -1;
- X end;
- X 6 : If Screen`5BPos_X,Pos_Y+1`5D = '`7E' Then Begin
- X Dir_X := 0; `7B Moving Right `7D
- X Dir_Y := 1;
- X end;
- X otherwise `7B Do Nothing Same Dir As Before `7D
- X end `7B Case `7D;
- X `7B Given LAst Direction Or New Direction `7D
- X If Screen`5BPos_X + Dir_X , Pos_Y + Dir_Y `5D = '`7E' Then Begin `2
- V0
- X`09 `7B Going into a Blank square ok to move `7D
- X Num_Moved := Num_Moved + 1;
- X Screen`5BPos_X ,Pos_Y `5D :=`20
- X Correct_sym(Move_X`5BPlay`5D,Move_Y`5BPLay`5D,Dir_X,Dir_Y)
- V;
- X pos(Pos_X,Pos_Y,Screen`5BPos_X,Pos_Y`5D);
- X Pos_X := Pos_X + Dir_X;
- X Pos_Y := Pos_Y + Dir_Y;
- X Screen`5BPos_X,Pos_Y`5D := 'O';
- X Pos(Pos_X,Pos_Y,Head_Sym`5BPLay`5D);
- X end else begin `7B You HAve Died Hit Into A Non Blank Square `7D
- X Died`5BPlay`5D := True;
- X If Num_PLayers <> Num_Moved_Last_Round Then `20
- X Score`5BPlay`5D := Score`5BPlay`5D +`20
- X (( Num_PLayers - Num_Moved_Last_Round + 1 )**2 * 100 )
- V`20
- X div ( NUm_Players**2);
- X pos(Pos_X,Pos_Y,Correct_sym(Move_X`5BPlay`5D,Move_Y`5BPLay`5D,Di
- Vr_X,Dir_Y));
- X Pos_X := Pos_X + Dir_X;
- X Pos_Y := Pos_Y + Dir_Y;
- X`09 Snake_Dead(play);`20
- X end;
- X Move_X`5BPlay`5D := Dir_X;
- X Move_Y`5BPLay`5D := Dir_Y;
- X`09 Head_X`5BPlay`5D := pos_X;
- X Head_Y`5BPlay`5D := Pos_Y;
- X end;
- Xend;
- X
- Xbegin
- X Num_Moved := 0; `7B Iniotalise Counter For The Number Who Move
- Vd `7D
- X If Players_reMoving = 1 Then Begin `7B If 1 Then Loop Clockwise `7D
- X For Play := 1 to Max_Player_number do`20
- X add_This_Players_head;
- X Remove_players_tail(1); `7B Remove Odd Players Tail `7D
- X PLayers_ReMoving := 2; `7B Next Round Shall remove Even
- V Ones `7D
- X end else`20
- X If Players_removing = 2 Then Begin
- X For Play := Max_Player_Number downto 1 do`20
- X add_This_Players_head; `7B Go Clockwise In Updatin
- Vg `7D
- X Remove_Players_tail(2);
- X PLayers_ReMoving := 1;
- X end else begin
- X For Play := Max_Player_Number downto 1 do `7B First Few Moves Don't
- V remove Tail `7D
- X add_This_Players_head; `7B Go Clockwise In Updatin
- Vg `7D
- X Players_removing := Players_removing + 1;
- X end;
- X If Num_Moved <= 1 Then Begin `7B Ie There IS Only 1 or 0
- V PLayers Left `7D
- X For PLay := 1 to Max_player_Number do Begin
- X`09If Not Quit`5BPlay`5D Then Begin
- X If Not Died`5BPLay`5D Then Begin
- X Score`5BPLay`5D := Score`5BPlay`5D + 100; `7B One Hundred
- V If You Last Left `7D
- X Games_Won`5BPLay`5D := Games_Won`5BPLay`5D + 1;
- X end;
- X Score_set(Play,Score`5BPlay`5D,Game`5BPlay`5D,Games_Won`5BPLay`5
- VD);
- X end;
- X end;
- X Add_head := 0; `7B Return 0 To Stop The Game `7D
- X end else`20
- X Add_Head := 1; `7B 1 To Comtinue `7D
- X Num_Moved_Last_Round := Num_Moved;
- X Break_Buff; `7B does not write the buffer just says To`20
- X Write this buffer to all the players when add_head exits
- V `7D
- Xend `7B add_Head`7D;
- X
- X
- XProcedure Snake_PLay;extern;
- X
- X
- XBegin `7B Mainline `7D
- X LineLimit(Output,MaxInt);
- X Initalise_Mainline;
- X While True Do Begin
- X Initalise_Positions; `7B initalises pos Only relavent for master
- V snake `7D
- X Snake_Play; `7B Calls Add_head with the Moves of the pla
- Vyers until add_head returns 1 ( end of game ) `7D
- X Draw_Scores;
- X Snake_Game_End; `7B Syncs all players Together `7D
- X end;
- X9999 :`20
- X Writeln(esc,'<');
- Xend.
- $ CALL UNPACK SNAKEP.PAS;4 141985560
- $ v=f$verify(v)
- $ EXIT
-